package com.pool1.queue2.threads;


import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


/**
 * Created by Administrator on 2018/5/9.
 */
@Component
@Scope("prototype")//spring 多例
public class BusinessThread implements Runnable {

    private String businessId;

    public BusinessThread(String orderId) {
        this.businessId = orderId;
    }

    public String getBusinessId() {
        return businessId;
    }

    public void setBusinessId(String acceptStr) {
        this.businessId = acceptStr;
    }

    @Override
    public void run() {
        //业务操作
        System.out.println("多线程已经处理订单插入系统，订单号：" + businessId);

        //线程阻塞 todo
        try {
            Thread.sleep(1000);
            System.out.println("多线程已经处理订单插入系统，订单号："+businessId);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
